﻿@model IEnumerable<MVC3.Models.Album>
@using MVC3.Helpers

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th></th>
        <th>
            GenreId
        </th>
        <th>
            ArtistId
        </th>
        <th>
            Title
        </th>
        <th>
            Price
        </th>
        <th>
            AlbumArtUrl
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.AlbumId }) |
            @Html.ActionLink("Details", "Details", new { id=item.AlbumId }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.AlbumId })
        </td>
        <td>
            @Html.Truncate(item.Genre.Name,25)
        </td>
        <td>
            @Html.Truncate(item.Artist.Name,25)
        </td>
        <td>
            @item.Title
        </td>
        <td>
            @String.Format("{0:F}", item.Price)
        </td>
        <td>
            <img src="@item.AlbumArtUrl" />
        </td>
    </tr>
}

</table>

